package com.hp.guard.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;

public class Utils {
	private static final String TAG = "Utils";

	public static String getVersion(Context context) {
		
		String currentVersion=null;
		try {
			PackageManager pm=context.getPackageManager();
			PackageInfo info=pm.getPackageInfo(context.getPackageName(), 0);
			currentVersion=info.versionName;
			Log.i(TAG, "version:"+currentVersion);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return currentVersion;
	}
}
